<!DOCTYPE html>
<title>Test that stalling very early, while loading meta-data, stops delaying the load event.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../../media-resources/media-file.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    var expectedEvents = ["loadstart", "stalled"];
    var watcher = new EventWatcher(t, video, expectedEvents);
    watcher.wait_for(expectedEvents).then(t.step_func(function() {
        // We want to make sure the onload event fires.
        window.onload = t.step_func_done();
    }));

    // Find a supported media file.
    var mediaFile = "content/test.ogv";
    var mimeType = mimeTypeForFile(mediaFile);

    // Load should stall very early in the loading process.
    video.src = "http://127.0.0.1:8000/resources/load-and-stall.php?name=../../../media/" + mediaFile + "&mimeType=" + mimeType + "&stallAt=1&stallFor=4";
});
</script>